package cn.e3mall.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.dubbo.container.page.Page;

import cn.e3mall.common.pojo.EasyUIDataGridResult;
import cn.e3mall.pojo.TbItem;
import cn.e3mall.service.ItemService;
@Controller
public class ItemController {

	@Autowired
	private ItemService itemService;
	
	@RequestMapping("/item/{itemId}")
	@ResponseBody
	public TbItem getItemById(@PathVariable long itemId){
		
		TbItem tbItem = itemService.getTbItemById(itemId);
		
		return tbItem;
	}
	
	
	//easyui的url中有路径
	@RequestMapping("/item/list")
	@ResponseBody
	public EasyUIDataGridResult showItemList(int page ,int rows){
		
		//调用service方法获取EasyUIDataGridResult 
		
		EasyUIDataGridResult result = itemService.getItemList(page, rows);
		
		
		
		return result  ;
		
		
	}
	
}
